package com.mayikt.days005;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @ClassName Test001
 * @Author 蚂蚁课堂余胜军 QQ644064779 www.mayikt.com
 * @Version V1.0
 **/
public class Test001 implements Callable<String> {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> stringFutureTask = new FutureTask<>(new Test001());
        new Thread(stringFutureTask).start();
        String result = stringFutureTask.get();
        System.out.println(result);
    }

    @Override
    public String call() throws Exception {
        try {
            Thread.sleep(3000);
            System.out.println(Thread.currentThread().getName() + ",发送短信完成。");
        } catch (Exception e) {

        }
        return "发送短信完成";
    }


}
